home *** CD-ROM | disk | FTP | other *** search
- Path: gsf.de!news
- From: Guido Kraus <guido.kraus@gsf.de>
- Newsgroups: comp.lang.c
- Subject: C time/date to Visual Basic time/date
- Date: 25 Jan 1996 08:31:32 GMT
- Organization: GSF
- Message-ID: <4e7f54$71t@cony.gsf.de>
- NNTP-Posting-Host: pc1676.gsf.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
-
- My problem:
-
- I'm currently working on a DLL which has to work together with Visual
- Basic. I'd like to return a date/time variable to Basic. Unfortunately
- Basic stores a date as days since 12/30/1899 (double variable; the
- fractional part represents hours, minutes and seconds) and C stores it as
- seconds since 01/01/1970 (long variable).
-
- I thought this would be easy and calculated the difference between these
- two dates in seconds, added the number of seconds to a C variable of type
- 'time_t' (long) and then devided this by 86400 (number of seconds of a
- day).
-
- {
- .
- .
- time_t timer;
- double VBtime;
-
- /* get current system time */
- time(&timer);
-
- /* VB_SECONDS = secs between 12/30/1899 and 1/1/1970 */
- VBtime=(double)(timer+VB_SECONDS);
- VBtime=(double)(timer/86400L);
- .
- .
- }
-
- I calculated VB_SECONDS in Visual Basic and got 2209125600. But it
- doesn't work this way.
- If there is someone out there who has a solution, please give me a hint.
-
- TIA,
- Guido
-
-